# -*- coding: utf-8 -*-
# @Time: 2022/7/5 10:32
# @Author: 发抖的小喵喵
# @Email: panyi_20210601@163.com
# @File: 退单品.py
# @Project: haixin
# @Software: PyCharm


from test_case.haixin.Method.Post import post_method
from random import randint
import time


def returnOrderItem():
    """
    我店退单品接口
    :return:
    """
    url = "https://api-test.shwoody.com/V2/ma/reOrder/returnOrderItem"

    data = {
        "shopId": "80101",
        "cashNo": "0007",  # 收款机号
        "saleNo": "2023082316544985371",  # 销售流水号
        "refundSn": time.strftime("%Y%m%d%H%M%S") + str(randint(10000, 99999)),  # 退款编号
        "userId": "1514150660671672320",
        "refundSuccess": True,  # 是否成功退货
        "refundAmount": 50,  # 现金支付的金额
        "items": [
            # {
            #     "skuId": "100010",
            #     "salePrice": 3,  # 销售单价  此处单价未做校验
            #     "qty": 2  # 数量
            # },
            {
                "skuId": "321123",
                "salePrice": 50,  # 销售单价  此处单价未做校验
                "qty": 1  # 数量
            }
        ]
    }

    response = post_method(data, url)
    print("接口响应数据：" + str(response))


if __name__ == "__main__":
    returnOrderItem()
